﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using CIIS.Common;
using Contract.Domain;
using DevExpress.XtraEditors;
using Framework.Domain;

namespace CIIS
{
    public partial class Verify : BaseForm
    {
        public Verify()
        {
            InitializeComponent();
            
            //todo pxc 默认分局审核已通过，需要根据当前登录判断
            lookUpEditSuggest.EditValue = "01";

            //todo pxc 按登录自动填入
            textEditShr.Text = "人";
            textEditShdw.Text = "部门";
            dateEditShsj.DateTime = DateTime.Now;

            buttonVerify.Click += new EventHandler(buttonVerify_Click);

            buttonVerify.DialogResult = DialogResult.OK;
        }

        public override void BindData(Entity entity)
        {
            base.BindData(entity);

            DevControlUtils.Instance.InitLookUpEdit(lookUpEditSuggest, dao.GetDropdownControlParam<bm_shzt>());
        }

        void buttonVerify_Click(object sender, EventArgs e)
        {
            try
            {
                BindEntity.State.MarkDirty();
                dao.Dao.SaveOrUpdate(BindEntity);
            }
            catch
            {
                XtraMessageBox.Show("审核失败。");
            }
            finally
            {
                Close();
            }
        }

        public string Shr
        {
            get { return textEditShr.Text; }
        }
        public string Shdw
        {
            get { return textEditShdw.Text; }
        }
        public string Bz
        {
            get { return memoEditBz.Text; }
        }
        public string Yj
        {
            get { return (lookUpEditSuggest.EditValue != null) ? lookUpEditSuggest.EditValue.ToString() : string.Empty; }
        }
        public DateTime Shsj
        {
            get { return dateEditShsj.DateTime; }
        }
    }
}
